<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="example">
    <my-component></my-component>
</div>
<script src="../js/vue.min.js"></script>
<script>
    //向子组件传递数据
    //省略extend方法，vue内部调用
    Vue.component('my-component', {
        data:function(){
            return{
                parentMsg: 'prop传值'
            }
        },
        //模板里不支持驼峰的属性写法，需要转换为‘-’连接的属性写法
        template: "<div >{{parentMsg}}Parent <child-component :my-message='parentMsg'></child-component></div>",
//        template: '<div>{{parentMsg}}<child-component :my-message="parentMsg"></child-component></div>',
        components: {
            'child-component': {
                props: ['myMessage'],
                template: '<div>下次V型从V型从{{myMessage}}</div>',
                data: function () {
                    return {}
                    
                }
            }
        }
    });
    // 创建根实例1
    new Vue({
        el: '#example'
    });
</script>
</body>
</html>